unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, TopMapDesignObjectManager;

type
  TForm1 = class(TForm)
    pnl1: TPanel;
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    FMapManager: TTopObjectManager;
    procedure FProgramOnClick(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

uses TopMapDesignBasic;

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
  FMapManager := TTopObjectManager.Create(pnl1);
  FMapManager.ProgramOnClick := FProgramOnClick;
  FMapManager.LoadFromFile('F:\tstProject\Delphi7.0\TestMap\testmap.Map');
end;

procedure TForm1.FProgramOnClick(Sender: TObject);
var
  sFileName: string;
begin
  sFileName := 'F:\tstProject\Delphi7.0\TestMap\'+TTopPanel(Sender).ProgramCode+'.exe';
  WinExec(PChar(sFileName), SW_SHOW);
end;

end.
